<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title></title>
    <style>
        html,
        body {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        body {
            background-color: black;
        }

        .main {
            height: 100%;
        }

        @media screen and (max-width: 1365px) {
            .main {
                width: 1023px;
                padding: 0;
            }
        }

        @media screen and (min-width: 1366px) {
            .main {
                width: 100%;
                padding: 0 128px;
                min-width: 1348px;
                box-sizing: border-box;
            }
        }

        .title {
            width: 100%;
            height: 54px;
        }

        .title .img {
            width: 116px;
            margin-top: 18px;
            height: 16px;
            line-height: 16px;
            float: left;
            background: url('./brand/index/logo.png');
        }

        .title .split {
            width: 10px;
            margin-top: 18px;
            margin-left: 8px;
            height: 16px;
            line-height: 16px;
            float: left;
            color: #fff;
        }

        .title .font {
            margin-top: 19px;
            margin-left: 8px;
            font-size: 13px;
            font-weight: 700;
            color: #fff;
            height: 16px;
            line-height: 16px;
            float: left;
        }

        .dialog {
            position: absolute;
            width: 434px;
            height: 302px;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            -ms-transform: translate(-50%, -50%);
            -moz-transform: translate(-50%, -50%);
            -webkit-transform: translate(-50%, -50%);
            -o-transform: translate(-50%, -50%);
            border: 1px solid black;
            background-color: #fff;
            border-radius: 6px;
        }

        .dialog_main {
            display: block;
            width: 400px;
            height: 300px;
            margin: 0 auto;
            padding: 0 16px;
            position: relative;
            color: #4e4e4e;
            font-size: 12px;
        }

        .dialog_title {
            height: 40px;
            line-height: 40px;
            position: relative;
            border-bottom: 1px solid #c0c5c8;
        }

        .dialog_close {
            position: absolute;
            top: 9px;
            cursor: pointer;
            right: 15px;
            width: 23px;
            height: 23px;
            background: url() no-repeat scroll 0 0 rgba(0, 0, 0, 0);
        }

        .dialog_content {
            width: 100%;
            height: 258px;
            line-height: 197px;
            text-align: center;
            font-size: 14px;
            position: relative;
        }

        .dialog_ok {
            width: 67px;
            margin: 0 2px;
            background: none repeat scroll 0 0 #f3f3f3;
            border: 1px solid #cccccc;
            color: #666;
            display: inline-block;
            font-size: 12px;
            height: 22px;
            line-height: 22px;
            text-align: center;
            cursor: pointer;
            text-decoration: none;
            position: absolute;
            bottom: 65px;
            left: 162px;
        }
    </style>
</head>

<body>
    <div id="main" class="main">

    </div>
</body>
<script>
    function t(text) {
        if (window.__i18n__) {
            try {
                var json = window.__i18n__.resources[window.__i18n__.locale]['translation']
                return json[text]
            } catch (err) { }
        } else {
            return text
        }
    }
    document.title = t(window.__COMPANY_INFO_i18n_key.title)
    window.onload = function () {
        var htmlStr = '<div class="title">' +
            '<div class="img"></div>' +
            '<div class="split">/</div>' +
            '<div class="font">' + t(window.__COMPANY_INFO_i18n_key.systemName) + '</div>' +
            '</div>' +
            '<div class="dialog" style="display: none">' +
            '<div class="dialog_main">' +
            '<div class="dialog_title">' + t('提示') + '</div>' +
            '<div class="dialog_close" id="dialog_close"></div>' +
            '<div class="dialog_content">' + t('直播暂未开始。') +
            '<span class="dialog_ok" id="dialog_ok">确定</span>' +
            '</div>' +
            '</div>' +
            '</div>'
        document.getElementById('main').innerHTML = htmlStr

        function getUrlParam(param) {
            var reg = new RegExp("(^|&)" + param + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substring(1).match(reg); //匹配目标参数
            if (r != null) return decodeURI(r[2]);
            return null; //返回参数值
        }
        var meetingMoid = getUrlParam('meetingMoid')
        var system_url = window.location.pathname.indexOf('/meetingCore') > -1 ? '/meetingapicoreweb' :
            '/meetingapiweb';
        var url = system_url + '/meetings/' + meetingMoid + '/liveurl'


        var _tmp = new window.XMLHttpRequest()
        _tmp.open('GET', url, false)
        _tmp.onreadystatechange = function () {
            if (_tmp.readyState === 4 && _tmp.status === 200) {
                try {
                    var res = JSON.parse(_tmp.responseText)
                    if (res.success && res.data) {
                        window.location.href = res.data;
                    } else {
                        document.getElementsByClassName('dialog')[0].setAttribute('style', 'display:block')

                        function hideDialog() {
                            document.getElementsByClassName('dialog')[0].setAttribute('style', 'display:none')
                        }
                        document.getElementById('dialog_close').addEventListener('click', hideDialog);
                        document.getElementById('dialog_ok').addEventListener('click', hideDialog);
                    }

                } catch (e) {
                    document.getElementsByClassName('dialog')[0].setAttribute('style', 'display:block')

                    function hideDialog() {
                        document.getElementsByClassName('dialog')[0].setAttribute('style', 'display:none')
                    }
                    document.getElementById('dialog_close').addEventListener('click', hideDialog);
                    document.getElementById('dialog_ok').addEventListener('click', hideDialog);
                }
            } else {
                document.getElementsByClassName('dialog')[0].setAttribute('style', 'display:block')

                function hideDialog() {
                    document.getElementsByClassName('dialog')[0].setAttribute('style', 'display:none')
                }
                document.getElementById('dialog_close').addEventListener('click', hideDialog);
                document.getElementById('dialog_ok').addEventListener('click', hideDialog);

            }
        }
        _tmp.send(null)
    }

</script>

</html>
